<!--<a href="#/layui/busiguanli" class="layui-btn layui-btn-xs layui-btn-primary" style="margin: 20px 0 0 30px;">
  <i class="layui-icon">&#xe65c;</i>
</a>

<h2 class="title">商圈成员列表</h2>-->

<div class="layui-body-header">
	<h2>
		<a href="#/layui/busiguanli">
		  <i class="layui-icon">&#xe65c;</i>
		</a>
		商圈成员列表
	</h2>
	
</div>




<div class="layui-card-body">
	<div class="layui-fluid">
		<div class="layui-card">
          <div class="layui-card-header">
            <!-- <span>所有会员列表</span> -->
            <!--<a href="#/member/all/edit" class="layui-btn layui-btn-xs">
              <i class="layui-icon">&#xe654;</i>
              <span>新增</span>
            </a>-->
            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-primary" onclick="del()">
              <i class="layui-icon">&#xe640;</i>
              <span>批量删除</span>
            </a>
            <!-- <a href="#/layui/changeFHMemLev" class="layui-btn layui-btn-sm layui-btn-primary">
              <i class="layui-icon">&#xe702;</i>
              <span>变更职务</span>
            </a> -->
            <!--<a href="#/member/all/edit" class="layui-btn layui-btn-sm layui-btn-primary">
              <i class="layui-icon">&#xe62f;</i>
              <span>导出到Excel</span>
            </a>-->
            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-primary" id="search_hash">
              <i class="layui-icon">&#xe615;</i>
            </a>
          </div>
          <div class="layui-card-body">
            <table id="test" lay-filter="test"></table>
            <script type="text/html" id="bartest">
              <button class="layui-btn layui-btn-xs" lay-event="changeScore">变更会员等级</button>
            </script>
          </div>
      	</div>
      </div>
    </div>
      
      <!--头部工具栏-->
      <script type="text/html" id="toolbarDemo">
			</script>

<script type="text/html" id="search_tpl_hash">
  <form class="layui-form" action="">
    <div class="layui-form-item">
      <label class="layui-form-label">会员姓名</label>
      <div class="layui-input-block">
        <input type="text" name="title" id="memName" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formtest"><i class="layui-icon">&#xe615;</i> 搜索</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</script>

<script>
  let selectId = []
  layui.config({
    base: '/src/js/'
  }).use(['jquery','table', 'sidebar', 'form','route'], function () {
    var $ = layui.jquery,
      layer = layui.layer,
      table = layui.table,
      sidebar = layui.sidebar,
      route = layui.route,
      params = route.params(),
      form = layui.form;
    
//  DBHelper.Get("Admin_Xn_CircleMember?id="+params.id,function(data){
//  	console.log("data",data)
//  },function(data){
//  	console.log(data)
//  })
    
    
    table.render({
      method: 'post',
      // size: 'sm',
      limit: 10,
      limits: [10,20,30],
      elem: '#test',
      id:'test',
      toolbar: '#toolbarDemo',
      height: 'full-235',
      contentType: 'application/json',
      where: {
      	"Name": "",
			  "AreaCode": "",
			  "CircleCategoryId": 2,
			  "CircleGuid": params.id,
			  "IsAudit": 1,
      },
      request: {
		    pageName: 'CurrentPage' //页码的参数名称，默认：page
		    ,limitName: 'PageSize' //每页数据量的参数名，默认：limit
		  },
      parseData: function(res){
      	return {
      		'code':0,
      		'count':res.TotalCount,
      		"data":res._Data
      	};
      },
      url: 'https://xnsmb.xnsoft.net.cn/api/Filtrate_Xn_CircleMember', //数据接口
      page: true, //开启分页
      cols: [
        [ //表头
          {
//          field: 'id',
//          title: 'ID',
			type: 'checkbox',
			align: 'center',
//          width: 150,
            sort: true,
          }, {
            field: 'MemLoginId',
            title: '会员ID',
            align: 'center',
//          width: 150
          }, {
            field: 'MemberName',
            title: '会员名称',
            align: 'center',
//          width: 150,
//          sort: true
          }, {
            field: 'MemberMobile',
            title: '手机号',
            align: 'center',
//          width: 150
          }, {
            field: 'RankName',
            title: '商圈成员等级',
            align: 'center',
//          width: 150
          }, {
            field: '',
            title: '会员职务',
            align: 'center',
//          width: 200,
						hide:true
          }, {
            field: 'CreateTime',
            title: '加入时间',
            align: 'center',
//          width: 150,
            sort: true,
//          templet:function (d) {
//                var a=d.CreateTime.split('T')
//                var c =a[1].split('.')
//                a = a[0]+' '+c[0]
//                return a
//              }
          }, {
//          width: 180,
            align: 'center',
            toolbar: '#bartest'
          }
        ]
      ]
    });

    $('#search_hash').on('click', function () {
      var that = this;
      // console.log($('#search_tpl_hash').html());
      sidebar.render({
        elem: that,
        content: $('#search_tpl_hash').html(),
        title: '搜索',
        shade: true,
        // shadeClose:false,
        // direction: 'left'
        // dynamicRender: false,
        // url: 'views/member/all/search.html',
        width: '500px', //可以设置百分比和px
        done: function () {
          console.log('ccc');
          form.render();

          //监听提交
          form.on('submit(formtest)', function (data) {
            // layer.msg(JSON.stringify(data.field));
            table.reload('test', {
              where: {
			      	"Name": $("#memName").val(),
						  "AreaCode": "",
						  "CircleCategoryId": 2,
						  "CircleGuid": params.id,
						  "IsAudit": 1,
			      }
            });
            return false;
          });
        }
      });
    });

    table.on('checkbox(test)',function (obj) {

      var checkStatus = table.checkStatus('test'); //idTest 即为基础参数 id 对应的值
      selectId = []
      for(var i = 0 ; i < checkStatus.data.length ; i++){
        selectId.push(checkStatus.data[i].Guid)
      }
    })
    
    table.on('tool(test)',function(obj){
    	toolHandel("","",obj,"","","#/layui/busiMemChange?id=");
    })
    
   //  batchDel.addEventListener("click",function(){
			// layer.confirm('确认删除？', function(index){
			// 		layer.close(index);	
			// 		console.log("checkedArr",checkedArr)
			// 		DBHelper.Delete("Admin_Xn_CircleMember",checkedArr,function(data){
			// 	      	console.log(data)
			// 	      },function(data){
			// 	      	table.reload('test', {
			// 					});
			// 	      	console.log(data)
			// 	      })
					
		 //    });
			
   //  })
    
  });

  //删除
    function del(){
      if (selectId.length == 0) {
        alert('请先选择需要删除项')
        return false
      }
      layui.use('form', function(){
       let index = layer.open({
          content: '确认删除？',
          yes: function(index, layero){
              DBHelper.Delete('Admin_Xn_CircleMember',selectId,function (res) {
                
              },function(res){
				location.href = window.location.href
                layer.close(index);
              }) 
          }
        })
      });
    }
</script>

<style scoped>
		.popuInfo-table tr>th{
			text-align: center;
		}
		.popuInfo-table tr>td{
			text-align: center;
		}
      	.block{
      		display: block;
      	}
      	.popuTop-btn{
      		width: 100%;
      		text-align: center;
      	}
      	.pupoInfo{
      		margin-top: 20px;
      	}
      	.popuTop-btn button{
      		display: inline-block;
      		width: 200px;
      		border-radius: 5px;
      	}
      	.title{
      		margin-left: 30px;
      		margin-top: 30px;
      	}
      	.save-warp{
      		width: 100%;
      		text-align: center;
      		margin-top: 20px;
      	}
      	.save-warp button{
      		display: inline-block;
      		width: 160px;
      	}
      	.popu-top{
      		display: flex;
      		justify-content: space-between;
      	}
      	.popu-table{
      		background-color: rgba(0,0,0,0);
      	}
      	
      	
      </style>